home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / ubiquity / apt-setup / generators / 91security < prev   
Encoding:
Text File  |  2009-01-09  |  1.9 KB  |  79 lines

  1. #!/bin/sh
  2. set -e
  3.  
  4. . /usr/share/debconf/confmodule
  5.  
  6. file="$1"
  7.  
  8. db_get apt-setup/services-select
  9. if ! echo "$RET" | grep -q security; then
  10.     exit
  11. fi
  12.  
  13. db_get apt-setup/security_host
  14. host="$RET"
  15. [ "$host" ] || exit
  16.  
  17. db_get apt-setup/security_path
  18. directory="$RET"
  19. [ "$directory" ] || exit
  20.  
  21. if ! db_get mirror/codename || [ -z "$RET" ]; then
  22.     db_get cdrom/codename
  23. fi
  24. codename="$RET"
  25.  
  26. # Awful Ubuntu-specific hack. *-security suites for ports architectures
  27. # aren't available on security.ubuntu.com, only on ports.ubuntu.com.
  28. if [ "$host" = security.ubuntu.com ]; then
  29.     db_get mirror/protocol
  30.     protocol="$RET"
  31.     db_get mirror/$protocol/hostname
  32.     if [ "$RET" = ports.ubuntu.com ]; then
  33.         host="$RET"
  34.         db_get mirror/$protocol/directory
  35.         directory="$RET"
  36.     fi
  37. fi
  38.  
  39. # To determine if restricted should be included, grep the file to see if it
  40. # is listed in it.
  41. dists="main"
  42. for dist in restricted; do
  43.     if grep -q '^[^#]* '$dist $ROOT/etc/apt/sources.list.new; then
  44.         dists="$dists $dist"
  45.     fi
  46. done
  47.  
  48. # Don't test mirror if no network selected in netcfg
  49. echo "deb http://$host$directory $codename-security $dists" >> $file
  50. echo "deb-src http://$host$directory $codename-security $dists" >> $file
  51.  
  52. # Security sources for Ubuntu universe; not used much, but e.g. unsupported
  53. # binary packages from a supported source package will end up here.
  54. if db_get apt-setup/universe && [ "$RET" = true ]; then
  55.     COMMENT=
  56. else
  57.     COMMENT='# '
  58. fi
  59. cat >> $file <<EOF
  60. ${COMMENT}deb http://$host$directory $codename-security universe
  61. ${COMMENT}deb-src http://$host$directory $codename-security universe
  62. EOF
  63.  
  64. # Security sources for Ubuntu multiverse, with the same caveats as for
  65. # universe.
  66. if db_get apt-setup/multiverse && [ "$RET" = true ]; then
  67.     COMMENT=
  68. else
  69.     COMMENT='# '
  70. fi
  71. cat >> $file <<EOF
  72. ${COMMENT}deb http://$host$directory $codename-security multiverse
  73. ${COMMENT}deb-src http://$host$directory $codename-security multiverse
  74. EOF
  75.  
  76. apt-setup-signed-release security.ubuntu.com "$file"
  77.  
  78. exit 0
  79.